Skip to content

fix: read-only mode - #2740

Merged
deadlyjack merged 1 commit into
mainfrom
fix/read-only
Aug 14, 2026
Merged

fix: read-only mode#2740
deadlyjack merged 1 commit into
mainfrom
fix/read-only

Conversation

@deadlyjack

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR centralizes CodeMirror read-only behavior so read-only documents remain selectable and navigable without focusing an editable input or opening the soft keyboard.

  • Adds coordinated state, DOM-editability, focus, transaction, pointer-selection, and context-menu guards.
  • Updates quick-tools, palettes, panels, commands, and navigation flows to respect read-only editors.
  • Adds unit coverage for read-only configuration, selection-menu filtering, quick-tools behavior, and TypeScript/TSX file icons.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue identified.

The coordinated read-only state, DOM editability, focus suppression, transaction filtering, selection handling, and quick-tools routing preserve non-editing interactions while blocking user-originated document mutations.

Important Files Changed

Filename Overview
src/cm/editorReadOnly.ts Introduces the shared read-only extension, focus and mutation guards, reconfiguration helpers, and read-only pointer-selection utilities.
src/lib/editorManager.js Applies the complete read-only extension throughout editor creation and file switching, while coordinating focus and native context-menu behavior.
src/cm/touchSelectionMenu.js Enables selection and custom context-menu interactions while read-only editors remain unfocused.
src/handlers/quickTools.js Routes quick-tools input through read-only-aware command, focus, modifier, and editing guards.
src/cm/quickToolsModifierInput.ts Adds read-only-aware modifier capture and consumes text input before it can mutate the document.
src/cm/selectionMenuUtils.ts Extracts typed selection-menu filtering based on selection state and read-only eligibility.
src/lib/editorFile.js Reconfigures active and pane-specific editors using the unified read-only behavior.
tests/unit/editorReadOnly.test.ts Covers read-only facets, mutation filtering, focus handling, selection collapse, context selection, and pointer-tap classification.
tests/unit/quickToolsReadOnly.test.ts Verifies quick-tools commands, mutation blocking, capture focus, and leaked input handling in read-only mode.
src/res/file-icons/style.css Extends the TypeScript icon selector to TS and TSX file classes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  FileState[File editable/loading state] --> Reconfigure[Reconfigure read-only compartment]
  Reconfigure --> StateFacet[EditorState.readOnly]
  Reconfigure --> DomFacet[EditorView.editable]
  Reconfigure --> Guards[Input, transaction, and focus guards]
  StateFacet --> Commands[Commands and quick tools]
  DomFacet --> Touch[Touch selection and context menu]
  Guards --> Unfocused[Keep read-only editor unfocused]
  Commands -->|Read-only-safe action| Selection[Selection/navigation update]
  Commands -->|Editing action| Blocked[Document change blocked]
  Touch --> Selection
Loading

Reviews (1): Last reviewed commit: "fix: read-only mode" | Re-trigger Greptile

@deadlyjack
deadlyjack requested review from RohitKushvaha01 and bajrangCoder and removed request for bajrangCoder August 14, 2026 09:57
@RohitKushvaha01 RohitKushvaha01 added the CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. label Aug 14, 2026
@github-actions github-actions Bot removed the CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. label Aug 14, 2026
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

Preview Release for this, has been built.

Click here to view that github actions build

@deadlyjack
deadlyjack added this pull request to the merge queue Aug 14, 2026
Merged via the queue into main with commit e5fa7d5 Aug 14, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Aug 14, 2026
@deadlyjack
deadlyjack deleted the fix/read-only branch August 14, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants